/**
 * @author LKQ
 * @date 2022/1/30 13:22
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums = {7,5,6,8,3};
        System.out.println(solution.findGCD(nums));
    }
    public int findGCD(int[] nums) {
        int min = 1001, max = 0;
        for (int a : nums) {
            if (a > max) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        if (max % min == 0) {
            return min;
        }
        int ans = 1;
        for (int i = min - 1; i >= 1; i--) {
            if (max % i == 0 && min % i == 0) {
                ans = i;
                break;
            }
        }
        return ans;
    }
}
